home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / MM2_DEV / S / TEST / LZW.M < prev    next >
Encoding:
Text File  |  1989-09-13  |  2.1 KB  |  3 lines

  1. ⓪ MODULE LZW;⓪ ⓪ FROM    InOut   IMPORT WriteString, WriteLn, WriteCard, Write, Read;⓪ ⓪ FROM Strings IMPORT Length;⓪ ⓪ FROM    SYSTEM  IMPORT ADDRESS, ADR, TSIZE;⓪ ⓪ FROM    Storage IMPORT ALLOCATE, DEALLOCATE;⓪ ⓪ FROM Compressions IMPORT GetInfo, Decode, Encode;⓪ FROM RandomGen IMPORT RandomCard;⓪ FROM SysUtil0 IMPORT VarEqual, ClearVar;⓪ IMPORT Files, Binary, Directory;⓪ ⓪ VAR s0, s1, s2, s3: ARRAY [0..1999] OF CARDINAL; cl,l: LONGCARD;⓪"s8: ARRAY [0..7] OF CHAR;⓪"f:Files.File;⓪"t: CARDINAL; ch: CHAR; ok: BOOLEAN;⓪ BEGIN⓪"Files.Open (f, 'G:\B', Files.readOnly);⓪"Binary.ReadBytes (f, ADR (s0), SIZE(s0), l);⓪"Files.Close (f);⓪"WriteString ('source len: ');WriteCard (l, 0);⓪"WriteLn;⓪"s1:= s0;⓪"Encode (0, ADR (s1), l, ADR (s2), SIZE (s2), cl);⓪"WriteString ('code len:   ');WriteCard (cl, 0);⓪"WriteLn;⓪"s8:= 'MM2Comp';⓪"(*⓪"Files.Create (f, 'G:\A.LZW', Files.writeOnly, Files.replaceOld);⓪"Binary.WriteBytes (f, ADR (s8), SIZE(s8));⓪"Binary.WriteBytes (f, ADR (s2), cl);⓪"Files.Close (f);⓪"*)⓪"Files.Open (f, 'G:\A', Files.readOnly);⓪"Binary.ReadBytes (f, ADR (s8), SIZE(s8), l);⓪"Binary.ReadBytes (f, ADR (s3), cl, l);⓪"Files.Close (f);⓪"GetInfo (ADR(s3), t, l);⓪"ClearVar (s1);⓪"Decode (ADR (s3), cl, ADR (s1), l, ok);⓪"WriteString ('source len: ');WriteCard (l, 0); WriteCard (t, 4);⓪"WriteLn;⓪"IF NOT ok THEN⓪$WriteString ('NOT ok')⓪"END;⓪"WriteLn;⓪"IF VarEqual (s1, s0) THEN⓪$WriteString ('OK')⓪"ELSE⓪$WriteString ('Error!')⓪"END;⓪"WriteLn;⓪"Read(ch);⓪ END LZW.⓪ ə
  2. (* $FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$0000059F$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEAB4E0$FFEAB4E0$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEC9760$FFEAB4E0$FFEC9760$FFEC9760$FFEC9760Ç$0000019CT.......T.......T.......T.......T.......T.......T.......T.......T.......T.......$000004B5$000004E1$FFEAB4E0$0000043B$00000425$00000446$00000475$0000048E$00000465$00000486$00000586$000004A6$000001A9$000004A6$00000486$0000019CêÇé*)
  3.